import 'babel-polyfill'
import promise from "es6-promise"

promise.polyfill();

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

Vue.config.productionTip = false

// iconfont
import iconfont from '@/assets/iconfont/iconfont.js'
import '@/assets/iconfont/iconfont.css'
// ElementUI
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);
//
import XEUtils from 'xe-utils'

Vue.prototype.$XEUtils = XEUtils

//
import moment from "moment"

Vue.prototype.$moment = moment

//
import VXETable from 'vxe-table'
import 'vxe-table/lib/style.css'

Vue.use(VXETable)
Vue.prototype.$XModal = VXETable.modal

//
import Avue from '@smallwei/avue';
import '@smallwei/avue/lib/index.css';

Vue.use(Avue);

//
import 'font-awesome/css/font-awesome.min.css'


Vue.prototype.$mapUrl = 'http://10.255.126.154:8088'


import global_mixins from "@/mixins/global-mixins"

Vue.mixin(global_mixins);

//
import GlobalTemplate from '@/components/my-template/GlobalTemplate'

Vue.component("GlobalTemplate", GlobalTemplate)

import BlackMask from '@/components/black-mask/index'

Vue.component("BlackMask", BlackMask)
//
import {userOneself} from '@/api/oneseIf-centre'

new Vue({
  router,
  store,
  render: h => h(App),
  beforeCreate() {
    if (this.$store.state.Authentication.access_token) {
      userOneself().then(res => {
        if (203 === res.code && !res.status) {
          this.$router.push({
            path: '/relogin',
            query: {
              t: Date.now(),
              furi: encodeURI(this.$route.path)
            }
          })
        }
      })
    }
  }
}).$mount('#app')
